﻿<UserControl x:Class="TecX.Agile.View.StoryCard"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:Converter="clr-namespace:TecX.Agile.View.Converter" 
             xmlns:Validation="clr-namespace:TecX.Agile.View.Validation" 
             xmlns:Behavior="clr-namespace:TecX.Agile.View.Behavior" 
             xmlns:Interactivity="clr-namespace:System.Windows.Interactivity;assembly=System.Windows.Interactivity" 
             mc:Ignorable="d" 
             d:DesignHeight="200" 
             d:DesignWidth="300"
            Width="300" 
            Height="200"             
             BorderBrush="Black"
             BorderThickness="1">
    <Interactivity:Interaction.Behaviors>
        <Behavior:RntBehavior/>
        <Behavior:TossingBehavior/>
    </Interactivity:Interaction.Behaviors>
    <UserControl.Resources>
        <ResourceDictionary>            
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="Resources/NamedStyles.xaml"/>
            </ResourceDictionary.MergedDictionaries>
            <Converter:ColorToSolidColorBrushConverter x:Key="ColorToSolidColorBrush_ValueConverter" />
            <Converter:StringToDoubleConverter x:Key="StringToDouble_ValueConverter" />
        </ResourceDictionary>
    </UserControl.Resources>
    <Grid 
        Background="{Binding Path=Background, Converter={StaticResource ColorToSolidColorBrush_ValueConverter}}">
        <Grid.RowDefinitions>
            <RowDefinition Height="2*" MinHeight="25"/>
            <RowDefinition Height="2*"/>
            <RowDefinition Height="1*"/>
            <RowDefinition Height="12*"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <TextBox
            x:Name="TaskName" 
            Style="{StaticResource HiddenTextBoxStyle}"
            Grid.ColumnSpan="3"
            Text="{Binding Path=Name, UpdateSourceTrigger=PropertyChanged}"/>
        <Rectangle
            Grid.ColumnSpan="3"
            Style="{StaticResource TopSeparator}"/>
        <TextBox 
            x:Name="MostLikelyEstimate"
            Style="{StaticResource HiddenTextBoxStyle}"
            Grid.Row="1">
            <TextBox.Text>
                <Binding Path="MostLikelyEstimate" Converter="{StaticResource StringToDouble_ValueConverter}" UpdateSourceTrigger="PropertyChanged">
                    <Binding.ValidationRules>
                        <Validation:DoubleOnlyValidationRule/>
                    </Binding.ValidationRules>
                </Binding>
            </TextBox.Text>
        </TextBox>
        <TextBox 
            x:Name="ActualEffort" 
            Style="{StaticResource HiddenTextBoxStyle}"
            Grid.Row="1" 
            Grid.Column="1">
            <TextBox.Text>
                <Binding Path="ActualEffort" Converter="{StaticResource StringToDouble_ValueConverter}" UpdateSourceTrigger="PropertyChanged">
                    <Binding.ValidationRules>
                        <Validation:DoubleOnlyValidationRule/>
                    </Binding.ValidationRules>
                </Binding>
            </TextBox.Text>
        </TextBox>
        <TextBox 
            x:Name="TaskOwner" 
            Style="{StaticResource HiddenTextBoxStyle}"
            Grid.Row="1" 
            Grid.Column="2"
            Text="{Binding Path=TaskOwner, UpdateSourceTrigger=PropertyChanged}"/>
        <TextBlock 
            Text="Mostlikely Estimate"
            Grid.Row="2"
            FontSize="8"/>
        <Rectangle 
            Grid.Row="1"
            Grid.ColumnSpan="3"
            VerticalAlignment="Bottom"
            Panel.ZIndex="50"
            IsHitTestVisible="False"
            Style="{StaticResource Separator}" />
        <TextBlock
            Text="Actual Effort"
            Grid.Row="2"
            Grid.Column="1"
            FontSize="8" />
        <TextBlock
            Text="Task Owner"
            Grid.Row="2"
            Grid.Column="2"
            FontSize="8"/>
        <TextBox 
            x:Name="Description" 
            Style="{StaticResource HiddenTextBoxStyle}"
            TextWrapping="Wrap" 
            Grid.Row="3" 
            Grid.ColumnSpan="6" 
            VerticalContentAlignment="Top"
            AcceptsReturn="True" 
            AllowDrop="False"
            Text="{Binding Path=Description, UpdateSourceTrigger=PropertyChanged}"/>
        <Grid 
            Grid.Row="2"
            Grid.RowSpan="2" 
            Grid.ColumnSpan="3" 
            IsHitTestVisible="False" 
            Panel.ZIndex="50">
            <Rectangle Style="{StaticResource Separator}" Margin="0,25,0,0" />
            <Rectangle Style="{StaticResource Separator}" Margin="0,50,0,0" />
            <Rectangle Style="{StaticResource Separator}" Margin="0,75,0,0" />
            <Rectangle Style="{StaticResource Separator}" Margin="0,100,0,0" />
            <Rectangle Style="{StaticResource Separator}" Margin="0,125,0,0" />
        </Grid>
        <Grid            
            x:Name="Overlay" 
            Grid.RowSpan="4"
            Grid.ColumnSpan="3"
            IsHitTestVisible="false"/>
    </Grid>
</UserControl>
